<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions" 
  xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
  xmlns:camunda="http://camunda.org/schema/1.0/bpmn"
  targetNamespace="Examples">
  
  <process id="fixSystemFailure" name="Fix system failure" isExecutable="true">
  
    <startEvent id="theStart" />
    
    <sequenceFlow id="flow1" sourceRef="theStart" targetRef="subProcess" />
    
    <subProcess id="subProcess">
    
      <startEvent id="subProcessStart" />
      <sequenceFlow id="flow2" sourceRef="subProcessStart" targetRef="subProcessFork" />
      
      <parallelGateway id="subProcessFork" />
      <sequenceFlow id="flow3" sourceRef="subProcessFork" targetRef="task1" />
      <sequenceFlow id="flow4" sourceRef="subProcessFork" targetRef="task2" />
      
      <userTask id="task1" name="Investigate hardware" camunda:candidateGroups="engineering" />
      <sequenceFlow id="flow5" sourceRef="task1" targetRef="subProcessJoin" />
      
      <userTask id="task2" name="Investigate software" camunda:candidateGroups="engineering" />
      <sequenceFlow id="flow6" sourceRef="task2" targetRef="subProcessJoin" />
      
      <parallelGateway id="subProcessJoin" />
      <sequenceFlow id="flow7" sourceRef="subProcessJoin" targetRef="subProcessEnd" />
      <endEvent id="subProcessEnd" />
    
    </subProcess>
    
    <!-- Timer on subprocess -->
    <boundaryEvent id="timer" attachedToRef="subProcess">
      <timerEventDefinition>
        <timeDuration>PT4H</timeDuration>
      </timerEventDefinition>
    </boundaryEvent>
    <sequenceFlow id="flow8" sourceRef="timer" targetRef="taskAfterTimer" />
    <userTask id="taskAfterTimer" name="Hand over to Level 2 support" camunda:candidateGroups="management" />
    <sequenceFlow id="flow9" sourceRef="taskAfterTimer" targetRef="theEnd1" />
    <endEvent id="theEnd1" />
    
    <sequenceFlow id="flow10" sourceRef="subProcess" targetRef="taskAfterSubProcess" />
    <userTask id="taskAfterSubProcess" name="Write report" camunda:candidateGroups="engineering" />
    <sequenceFlow id="flow11" sourceRef="taskAfterSubProcess" targetRef="theEnd" />
    <endEvent id="theEnd" />
    
  </process>

</definitions>